#ifndef TESTUTILS_H
#define	TESTUTILS_H

#include <float.h>
#include <stdlib.h>

int compare(float x1, float x2, float eps = FLT_EPSILON);
int compare(const float *v1, const float *v2, size_t count, float eps = FLT_EPSILON);

inline float getRandom() {	
    return rand() / (RAND_MAX + 1.0f);
}

inline float getRandom(float low, float high) {
    return low + (high - low) * getRandom();
}

inline float fillRandom(float *v, size_t count) {
    for (size_t i = 0; i < count; i++) {
        v[i] = getRandom();
    }
}

inline float fillRandom(float *v, size_t count, float low, float high) {
    for (size_t i = 0; i < count; i++) {
        v[i] = getRandom(low, high);
    }
}

#endif	/* TESTUTILS_H */

